package com.zcp.demo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import rx.Subscriber;

public class MainActivity extends AppCompatActivity {

    @Bind(R.id.lv)
    ListView lv;

    ArrayList<String> arr = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        setData();

    }

    public void setData() {
        Subscriber<TuijianInfo> subscriber = new Subscriber<TuijianInfo>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(TuijianInfo tuijianInfo) {
                List<TuijianInfo.ResultBean> list = tuijianInfo.result;
                // Log.d("zzz","list+**"+list.toString());
                lv.setAdapter(new MyAdapter(MainActivity.this, list));
            }
        };
        HttpMethods.getInstance().getData(subscriber, "android", "", "412001");
    }
}
